%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/functions/computed-column-forums-messages-list-set"
    Bucket0("Bucket 0 (root)<br /><br />1: PgSelectInlineApply[35]<br />ᐳ: 9, 10, 22, 39, 11, 13<br />2: PgSelect[8]<br />ᐳ: Access[36]<br />3: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 36<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 36, 15, 16<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: List[37], Lambda[38]<br />2: PgSelectRows[24]<br />3: __ListTransform[23]"):::bucket
    Bucket3("Bucket 3 (subroutine)<br /><br />ROOT PgClassExpression{3}ᐸ__forums_m..._set_idx__ᐳ[27]"):::bucket
    Bucket4("Bucket 4 (listItem)<br /><br />ROOT __Item{4}ᐸ23ᐳ[28]"):::bucket
    Bucket6("Bucket 6 (listItem)<br /><br />ROOT __Item{6}ᐸ28ᐳ[31]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 32<br /><br />ROOT PgSelectSingle{6}ᐸforums_messages_list_setᐳ[32]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3 & Bucket4
    Bucket4 --> Bucket6
    Bucket6 --> Bucket7

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ"]]:::plan
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'INHERIT' ]ᐳ[39]"}}:::plan
    PgFromExpression22{{"PgFromExpression[22∈0] ➊"}}:::plan
    PgSelectInlineApply35["PgSelectInlineApply[35∈0] ➊"]:::plan
    Object11 & Lambda13 & PgFromExpression22 & PgSelectInlineApply35 --> PgSelect8
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Access36{{"Access[36∈0] ➊<br />ᐸ8.m.subqueryDetailsFor18ᐳ"}}:::plan
    PgSelect8 --> Access36
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    List37{{"List[37∈2]<br />ᐸ36,15ᐳ"}}:::plan
    Access36 & __Item15 --> List37
    __ListTransform23[["__ListTransform[23∈2]<br />ᐸpartitionByIndex1:18ᐳ"]]:::plan
    PgSelectRows24[["PgSelectRows[24∈2]"]]:::plan
    PgSelectRows24 --> __ListTransform23
    Lambda38{{"Lambda[38∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda38 --> PgSelectRows24
    List37 --> Lambda38
    __Item25[/"__Item[25∈3]<br />ᐸ24ᐳ"\]:::itemplan
    PgSelectRows24 -.-> __Item25
    PgSelectSingle26{{"PgSelectSingle[26∈3]<br />ᐸforums_messages_list_setᐳ"}}:::plan
    __Item25 --> PgSelectSingle26
    PgClassExpression27{{"PgClassExpression[27∈3]<br />ᐸ__forums_m..._set_idx__ᐳ"}}:::plan
    PgSelectSingle26 --> PgClassExpression27
    __Item28[/"__Item[28∈4]<br />ᐸ23ᐳ"\]:::itemplan
    __ListTransform23 ==> __Item28
    __Item31[/"__Item[31∈6]<br />ᐸ28ᐳ"\]:::itemplan
    __Item28 ==> __Item31
    PgSelectSingle32{{"PgSelectSingle[32∈6]<br />ᐸforums_messages_list_setᐳ"}}:::plan
    __Item31 --> PgSelectSingle32
    PgClassExpression33{{"PgClassExpression[33∈7]<br />ᐸ__forums_m...t__.”body”ᐳ"}}:::plan
    PgSelectSingle32 --> PgClassExpression33
    PgClassExpression34{{"PgClassExpression[34∈7]<br />ᐸ__forums_m...”featured”ᐳ"}}:::plan
    PgClassExpression33 o--o PgClassExpression34

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,PgFromExpression22,PgSelectInlineApply35,Access36 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,__ListTransform23,PgSelectRows24,List37,Lambda38 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item25,PgSelectSingle26,PgClassExpression27 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,__Item28 bucket4
    classDef bucket6 stroke:#ff1493
    class Bucket6,__Item31,PgSelectSingle32 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression33,PgClassExpression34 bucket7

